package com.utils.generalConfigType.controller;

import com.utils.generalConfigType.pojo.GeneralConfigType;
import com.utils.generalConfigType.service.GeneralConfigTypeService;
import com.utils.common.ServerResponse;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
* 描述:
* author: srdl
* date: 2022-01-05
*/

@RestController
@RequestMapping(value="/generalConfigType")
public class GeneralConfigTypeController {

    @Autowired
    private GeneralConfigTypeService generalConfigTypeService;

    @GetMapping(value="/list")
    public ServerResponse list(){
        return generalConfigTypeService.list();
    }

    @GetMapping(value="/pageList")
    public ServerResponse pageList(PageInfo pageInfo){
        return generalConfigTypeService.pageList(pageInfo);
    }

    @GetMapping(value = "/get/{id}")
    public ServerResponse getById(@PathVariable String id){
    return generalConfigTypeService.get(id);
    }

    @PostMapping(value = "/add")
    public ServerResponse addGeneralConfigType(@RequestBody @Validated GeneralConfigType generalConfigType){
        return generalConfigTypeService.addGeneralConfigType(generalConfigType);
    }

    @PutMapping(value = "/delete/{id}")
    public ServerResponse deleteGeneralConfigType(@PathVariable String id){
        return generalConfigTypeService.deleteGeneralConfigType(id);
    }

    @PostMapping(value = "/update")
    public ServerResponse updateGeneralConfigType(@RequestBody @Validated GeneralConfigType generalConfigType){
        return generalConfigTypeService.updateGeneralConfigType(generalConfigType);
    }

}
